package com.goblin.model.order.po;

import com.goblin.model.base.BaseEntity;
import lombok.Data;

import javax.persistence.*;

@Data
@Table(name = "t_order_product")
@Entity
public class OrderProduct extends BaseEntity {

    @Column(name = "order_code", columnDefinition = "varchar(255) COMMENT '所属订单号'")
    private String orderCode;

    @Column(name = "goods_name", columnDefinition = "varchar(255) COMMENT '商品名'")
    private String goodsName;

    @Column(name = "count", columnDefinition = "int(4) COMMENT '商品数量'")
    private Integer count;

    @Column(name = "price", columnDefinition = "double(10,2) COMMENT '商品价格'")
    private Double price;

    @OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    @JoinColumn(name = "specVaue_id", referencedColumnName = "id", nullable = false, columnDefinition = " int(11) COMMENT '规格值id'")
    private Brand brand;

    @OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    @JoinColumn(name = "sku_id", referencedColumnName = "id", nullable = false, columnDefinition = " int(11) COMMENT 'sku id'")
    private SKU sku;
}
